<?php


class Sfs_Core_Config
{
    const KEY = 'Sfs_Core_Config_';

    /**
     * Get application config object
     *
     * @return Zend_Config
     */
    public static function getConfig()
    {
        $host = $_SERVER['SERVER_NAME'];
        $host = (substr($host, 0, 3) == 'www') ? substr($host, 4) : $host;

        $key = self::KEY.$host;
        if (!Zend_Registry::isRegistered($key)) {
            $defaultConfig = APPLICATION_PATH.'/configs'.DIRECTORY_SEPARATOR.'application.ini';
          //  $hostConfig = TOMATO_APP_DIR.DS.'config'.DS.$host.'.ini';
           // $file = file_exists($hostConfig) ? $hostConfig : $defaultConfig;

            $config = new Zend_Config_Ini($defaultConfig);
            Zend_Registry::set($key, $config);
        }

        return Zend_Registry::get($key);
    }
}